﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<ShopOnline.Models.Product>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	ViewDetail
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>ViewDetail</h2>

    <table>
        <tr>

            <th>
                productId
            </th>
            <th>
                productName
            </th>
            
            <th>
                piority
            </th>
            <th>
                show
            </th>
            <th>
                showAdvert
            </th>
            <th>
                productCatelogyId
            </th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>

            <td>
                <%= Html.Encode(item.productId) %>
            </td>
            <td>
                <%= Html.Encode(item.productName) %>
            </td>
            
            <td>
                <%= Html.Encode(item.piority) %>
            </td>
            <td>
                <%= Html.Encode(item.show) %>
            </td>
            <td>
                <%= Html.Encode(item.showAdvert) %>
            </td>
            <td>
                <%= Html.Encode(item.productCatelogyId) %>
            </td>
        </tr>
    
    <% } %>

    </table>
               <div>
                    <% 
                        int n = (int)ViewData["count"];
                        
                       int c = n % 6 == 0 ? n / 6: (n / 6) + 1;%>
                    <div class="pagination">
                        <ul>
                            <li><a href="/Product/ViewDetail?n=0&&cateId=<%=(int)ViewData["cateId"] %>" class="currentpage">1</a></li><%
                                                                                                            for (int i = 2; i <= c; i++)
                                                                                                            {%>
                            <li><a href="/Product/ViewDetail?n=<%=(i-1)*6 %>&&cateId=<%=(int)ViewData["cateId"] %>">
                                <%=i %></a></li>
                            <%
                                } %></ul>
                    </div>
                </div>
    <p>
        <%= Html.ActionLink("Create New", "Create") %>
    </p>

</asp:Content>

